package com.cf.user.login.service;


import com.cf.user.login.model.UserInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public interface TokenManager {
    /**
     * 生成token
     *
     * @param userInfo
     * @param request
     * @param response
     * @return
     */
    String setToken(UserInfo userInfo, HttpServletRequest request, HttpServletResponse response);


    /**
     * 校验token
     *
     * @param request
     * @return
     */
    UserInfo userInfo(HttpServletRequest request);

    /**
     * 校验token
     *
     * @param token
     * @return
     */
    UserInfo userInfo(String token);

    /**
     * registerToken
     *
     * @param userInfo
     * @return
     */
    String registerToken(UserInfo userInfo);

    /**
     * registerToken
     *
     * @param userId
     * @return
     */
    String registerToken(long userId);

    /**
     * 获取token
     * @param request
     * @return
     */
    String getToken(HttpServletRequest request);
}
